package com.mz.mattress.admin.service.impl;

import com.mz.mattress.admin.mapper.ActivityItemMapper;
import com.mz.mattress.admin.service.ActivityItemService;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.ActivityItem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Slf4j
@Service
public class ActivityItemServiceImpl implements ActivityItemService {

    @Autowired
    private ActivityItemMapper activityItemMapper;

    @Override
    public Result<List<ActivityItem>> selectByActivityId(Integer activityId) {
        List<ActivityItem> list = activityItemMapper.selectByActivityId(activityId);
        return Result.ok(list);
    }

    @Override
    public Result add(ActivityItem activityItem) {
        activityItemMapper.insert(activityItem);
        return Result.ok();
    }

    @Override
    public Result updateById(ActivityItem activityItem) {
        activityItemMapper.updateById(activityItem);
        return Result.ok();
    }

    @Override
    public Result deleteByIds(Set<Integer> ids) {
        activityItemMapper.deleteBatchIds(ids);
        return Result.ok();
    }
}
